package com.jcl.recruit.resume.logic;

import com.jcl.core.utils.CollectionUtils;
import com.jcl.recruit.resume.dao.ResumeSelfEvaluationDao;
import com.jcl.recruit.resume.model.ResumeSelfEvaluation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName ResumeSelfEvaluationLogic

 * @Author yyliu
 * @Date 2018/11/17 11:53
 * @Version 1.0
 **/
@Component
public class ResumeSelfEvaluationLogic {

    @Autowired
    ResumeSelfEvaluationDao resumeSelfEvaluationDao;

    public Map<Integer, ResumeSelfEvaluation> findEntityMapByResumeIds(String corpCode, List<Integer> resumeIds) {
        Map<Integer, ResumeSelfEvaluation> dataMap = new HashMap<>();
        List<ResumeSelfEvaluation> list = resumeSelfEvaluationDao.findListByResumeIds(corpCode, resumeIds);
        if (CollectionUtils.isNotEmpty(list)) {
            for (ResumeSelfEvaluation entity : list) {
                dataMap.put(entity.getResumeId(), entity);
            }
        }

        return dataMap;
    }

    public List<ResumeSelfEvaluation> findListByResumeIds(String corpCode, List<Integer> resumeIds) {
        return resumeSelfEvaluationDao.findListByResumeIds(corpCode, resumeIds);
    }

    public Map<String, Object> findOneMap(String corpCode, Integer resumeId) {
        return resumeSelfEvaluationDao.findOneMap(corpCode, resumeId);
    }

    public ResumeSelfEvaluation findOne(String corpCode, Integer resumeId) {
        return resumeSelfEvaluationDao.findOne(corpCode, resumeId);
    }

    public int add(ResumeSelfEvaluation entity) {
        return resumeSelfEvaluationDao.add(entity);
    }

    public int batchDeleteByResumeIds(String corpCode, List<Integer> resumeIds) {
        return resumeSelfEvaluationDao.batchDeleteByResumeIds(corpCode, resumeIds);
    }
}
